package common.utils;

import common.entity.course;
import common.entity.course_video;

//课程工具类
public  abstract class courseUtils extends pictUtils{
    /**
     * 目录最多级数
     */
    public static final Integer MaxGrade=10;
    /**
     * 查询数据库是like语句 不能修改
     * %-%-%-%-%-%-%-%-%-%
     */
    public static final StringBuilder MaxGradeLike= new StringBuilder("%").append("-%".repeat(9));


    public static final String parentFile="/course/";
    /**
     * 设置课程图片名称
     * @param course
     */
    public static String setCoursePictName (course course, String PictType) throws Exception{
        if(!pictTypes.contains(PictType)){throw new Exception("该图片为不支持的格式:"+PictType+"\n支持的图片格式为+"+ pictTypes);}
        return course.getId() + "_course_" + course.getName()+PictType;
    }
    /**
     * 建议尺寸 900x704
     */
    public static final String CoverPict="pict/cover/";
    /**
     * 设置课程视频图片名词
     * @param course
     * @return
     */
    public static String setCourse_video_coverName (course_video course, String PictType)  throws Exception{
        if(!pictTypes.contains(PictType)){throw new Exception("该图片为不支持的格式:"+PictType+"\n支持的图片格式为+"+ pictTypes);}
        return course.getCourse_id()+"_course_video_"+course.getId()+PictType;
    }
    public static final String Course_video_cover="pict/course_video_cover/";
}
